package com.xu.myTest;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.xu.model.Student;
import com.xu.model.Teacher;
import org.apache.commons.lang.StringUtils;

import java.util.List;

/**
 * json转对象
 */
public class Json2Object {

    public static void main(String[] args) {
        String value = "{\"student_id\":\"001\",\"student_name\":\"静静\"}";
        //json字符串转对象
        Student s = JSON.parseObject(StringUtils.trim(value),Student.class);

        System.out.println(JSON.toJSONString(s,true));

    }


}
